<?php
class Admin_Form_Search_Enquire extends Apps_Plugin_Grid_Search_Abstract {
    public function preInit() {
        $advancedCriteria = array(
            'name' => array(
                    'enquire.full_name',
                    self::$criteriaStringLike,
                    array(
                            'element'  => self::ELEMENT_TEXT,
                            'label'    => 'Người gửi',
                    )
            ),
            'email' => array(
            		'enquire.email',
            		self::$criteriaStringLike,
					array(
							'element'	   => self::ELEMENT_TEXT,
							'label'		   => 'Email',
					)
            ),
            'subject' => array(
            		'enquire.subject',
            		self::$criteriaStringLike,
					array(
							'element'	   => self::ELEMENT_TEXT,
							'label'		   => 'Tiêu đề',
					)
            ),
            'message' => array(
            		'enquire.message',
            		self::$criteriaStringLike,
					array(
							'element'	   => self::ELEMENT_TEXT,
							'label'		   => 'Nội dung',
					)
            ),
            'category' => array(
            		'enquire.reference_type',
            		self::$criteriaSimple,
					array(
							'element'	   => self::ELEMENT_SELECT,
							'label'		   => 'Chuyên mục',
							'multiOptions' => array(
												M_DbTable_Enquire::REFERENCE_TYPE_TOUR 			=> 'Tour',
												M_DbTable_Enquire::REFERENCE_TYPE_HOTEL 		=> 'Hotel',
												M_DbTable_Enquire::REFERENCE_TYPE_NOT_DEFINE 	=> 'Chưa xác định'
											)
					)
            )
        );

        $simpleCriteria = array(
        		array('enquire.id LIKE ?', '%%%s%%'),
        		array('enquire.full_name LIKE ?', '%%%s%%'),
        		array('enquire.email LIKE ?', '%%%s%%'),
        		array('enquire.subject LIKE ?', '%%%s%%'),
        		array('enquire.message LIKE ?', '%%%s%%')
        );

        $this->setAdvCriteria($advancedCriteria);
        $this->setSplCriteria($simpleCriteria);
    }
}